<template>
  <div>
    <el-tag>跟进记录</el-tag>
    <div v-for="item in dataList" style="font-size: 10px;">
      <el-row v-if="item.trackStatus">
        <el-col :span="8">跟进状态</el-col>
        <el-col :span="16"><span>{{selectDictLabel(dict.type.track_status,item.trackStatus)}}</span></el-col>
        <!--        <el-col :span="16">{{item.operParam.trackStatus}}</el-col>-->
      </el-row>
      <el-row v-if="item.nextTime">
        <el-col :span="8">下次跟进时间</el-col>
        <el-col :span="16"><span>{{item.nextTime}}</span></el-col>
      </el-row>
      <el-row v-if="item.level">
        <el-col :span="8">意向等级</el-col>
        <el-col :span="16"><span>{{selectDictLabel(dict.type.clues_level ,item.level)}}</span></el-col>
        <!--        <el-col :span="16">{{item.operParam.level}}</el-col>-->
      </el-row>
      <el-row v-if="item.subject">
        <el-col :span="8">意向学科</el-col>
        <el-col :span="16"><span>{{selectDictLabel(dict.type.course_subject ,item.subject)}}</span></el-col>
      </el-row>
      <!--      <el-row>-->
      <!--        <el-col :span="8">沟通内容</el-col>-->
      <!--        <el-col :span="16">{{item.operParam.record}}</el-col>-->
      <!--      </el-row>-->
      <el-row>
        <el-col :span="8">记录人</el-col>
        <el-col :span="16">{{item.createBy}}</el-col>
      </el-row>
      <el-row>
        <el-col :span="8">记录时间</el-col>
        <el-col :span="16">{{parseTime(new Date(item.lastUpdateTime),'{y}-{m}-{d}') }}</el-col>
      </el-row>
      <el-row>
        <el-col :span="8">
          <span>沟通内容</span>
        </el-col>
        <el-col :span="16"><span>{{item.record}}</span></el-col>
      </el-row>
      <hr>
    </div>
  </div>
</template>

<script>
  import {list} from '@/api/monitor/operlog'
  import {listTrackLog} from "../../../../api/crm/trackLog";

  export default {
    name: "track-list",
    dicts: ['clues_level', 'occupation', 'education', 'major', 'job', 'salary', 'sys_user_sex', 'course_subject', 'track_status', 'communication_point'],
    props: {
      id: {
        type: [String, Number],
      },
    },
    data() {
      return {
        dataList: [],
        search: '商机',
      }
    },
    created() {
      this.getList()
    },
    methods: {
      getList() {
        // list({title: '线索跟踪记录'}).then(res => {
        //   this.dataList = this.parseDate(res.rows)
        // })
        listTrackLog({id: this.id, table: this.search}).then(resp => {
          this.dataList = resp.rows;
        })
      },
      parseDate(result) {
        let list = [];
        if (result && result.length > 0) {
          for (let item of result) {
            let operParam = JSON.parse(item.operParam);
            // console.log(operParam.id)
            // console.log(this.id)
            if (operParam.id == this.id) {
              item.operParam = operParam;
              list.push(item)
            }
          }
        }
        return list
      },
      handleSubject(item) {
        return this.selectDictLabel(this.dict.type.course_subject, item.operParam.subject)
      },
      handelStatus(item) {
        return this.selectDictLabel(this.dict.type.track_status, item.operParam.trackStatus)
      },
      handleLevel(item) {
        return this.selectDictLabel(this.dict.type.clues_level, item.operParam.level)
      },
      // handleCommunicationPoint(item){
      //   return this.selectDictLabel(this.dict.type.clues_level, item.operParam.level)
      // }
    }
  }
</script>

<style scoped>

</style>

